<? 
session_start();
include("../../MerchandiseBay/conn.php");?>



<?

//$category=$_REQUEST['category'];
  /*$sqlMerchandise="select * from merchandise where category='$category' and sold_date='00000000'";*/
$sqlMerchandise="select * from merchandise";
$qryMerchandise=mysql_query($sqlMerchandise,$conn);


?>
<HEAD>

<TITLE>Untitled Document</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE type=text/css>BODY {
       COLOR: #ffff00
       }
       TD {
       COLOR: #ffff00
       }
       TH {
       COLOR: #ffff00
       }
       BODY {
       BACKGROUND-COLOR: #0099FF}
       </STYLE>

<META content="MSHTML 6.00.2900.2523" name=GENERATOR>
<script type="text/javascript" src="js.js"></script>

<script type="text/javascript">
window.onload = function(){
document.getElementById('confirmReserve').onclick = function() {extractQuatity();};

var extractQuatity = function()
{
	var oTotalObject = getElementsByClassName('menu');
	var ordered = Array();
	var count = 0;
	for(var i = 0; i < oTotalObject.length; i++)
	{
		if(oTotalObject[i].selectedIndex > 0)
		{
			ordered[oTotalObject[i].name] = oTotalObject[i].selectedIndex;
			count++;
		}
	}
	var sString = '';
	if(count>0)
	{
		for(var ele in ordered)
		{
			if(sString)
			{
				sString += ',';
			}
			sString += ele + '=' + ordered[ele]; 
		}
		fncCommit(sString);
	}
	else
	{
		alert('Please choose at least one item to continue');
		return false;
	}
	//console.log(oTotalObject[1].selectedIndex, oTotalObject[1].name);
};

var fncCommit = function(sValue)
{
	document.getElementById('orderlist').value = sValue;
	document.getElementById('commitReserve').submit();
};

//getElementsByClassName('menu');
}
</script>

</HEAD>
<BODY link="#FFCC00">

<table border="0" width="100%" id="table1">
<tr>
<td height="21"><p>&nbsp;</p>

</td>
</tr>
<tr>
<td height="123">
<table border="0" width="69%" id="table2">
<?if($category!="none") {?>
    <tr>
    <td width="66" valign="top" bgcolor="#333333"><div align="center"><b><font size="2" face="Verdana">Quantity</font></b></div></td>
    <td width="71" valign="top" bgcolor="#333333"><div align="center"><b><font size="2" face="Verdana">Food Code</font></b></div></td>
    <td width="128" valign="top" bgcolor="#333333"><div align="center"><b><font size="2" face="Verdana">Category</font></b></div></td>
    <td width="122" bgcolor="#333333" valign="top"><div align="center"><strong><font size="2" face="Verdana">Name</font></strong></div></td>
    <td width="96" bgcolor="#333333" valign="top"><div align="center"><b> <font size="2" face="Verdana">Price</font></b></div></td>
    <td bgcolor="#333333" valign="top" width="147"><div align="center"><strong><font size="2" face="Verdana">Picture</font></strong></div></td>
    </tr>
    <? while($rowMerchandise=mysql_fetch_assoc($qryMerchandise)){?>
        <tr>
        <td valign="top"><font face="Verdana" size="2" color="#FFFFFF">&nbsp;</font>
          
          <label>
            <select name="<?php echo $rowMerchandise['regno']; ?>" class="menu" id="course_<?=$rowMerchandise['id']; ?>">
              <option value="0" selected>---</option>
              <option>1</option>
              <option>2</option>
              <option>3</option>
              <option>4</option>
              <option>5</option>
              <option>6</option>
              <option>7</option>
              <option>8</option>
              <option>9</option>
              <option>10</option>
            </select>
          </label>
        <td valign="top"><font face="Verdana" size="2" color="#FFFFFF">&nbsp;
        </font>
        <font face="Verdana" size="2" color="#FFFFFF">
        <?=$rowMerchandise['regno']?>
        </font></td>
        <td valign="top"><font face="Verdana" size="2" color="#FFFFFF">&nbsp;
        <?=$rowMerchandise['category']?>
        </font></td>
        <td width="122" valign="top"> <font face="Verdana" size="2" color="#FFFFFF">&nbsp;
        <?=$rowMerchandise['kind']?>
        </font></td>
        <td width="96" valign="top"> <font size="2" face="Verdana" color="#FFFFFF">
        <?=$rowMerchandise['price']?>
        </font></td>
        <td valign="top" width="147"> <font face="Verdana" size="2" color="#FFFFFF">&nbsp;<img src="../Admin/productpic/<?=$rowMerchandise['pic']?>" alt="<?=$rowMerchandise['kind']?>" border="1" hspace="7" vspace="2" width="67" height="67"></font></td>
        </tr>
        <? }
}?>
    </table>
        <div style="text-align:left">
        <input type="submit" name="confirm" value="confirm" id="confirmReserve">
    </div>
    <form method="POST" action="reservationForm2.php" id="commitReserve">
		<input type="hidden" name="reservationdate" value="<?  echo $_REQUEST[date]; ?>">
        <input type="hidden" name="time" value="<?  echo $_REQUEST[time]; ?>">
		<input type="hidden" id="orderlist" name="orderList" />
    </form>

    </BODY></HTML>